
import * as methds from './actionTypes';
import axios from 'axios';
export const setHandleInputVale = (value) => ({
    type: methds.HANDLE_CHANGE_VALUE,
    value
});

export const setHandleSubmit = () => ({
    type: methds.HANDLE_SUBMIT
});

export const setHandleDeleteItem = (index) => ({
    type: methds.HANDLE_DELETE_ITEM,
    index
});

export const setInitData = (data) => ({
    type: methds.INIT_DATA,
    data
});


// export const getInitData = () => ({
//     type: methds.GET_INIT_DATA
// });

export const getInitData = () => {
  return (dispatch) => {
      axios.get("/mock/list.json").then(res => {
          let data = res.data;
          const action = setInitData(data);
          dispatch(action);
      })
  }
};